#ifndef __WIZ_DATATYPE_ENBALE_SHARED_FROM_THIS_HPP__SHANHAOBO_19800429__
#define __WIZ_DATATYPE_ENBALE_SHARED_FROM_THIS_HPP__SHANHAOBO_19800429__

#include "./WizDataTypeWeakPtr.hpp"
#include "./WizDataTypeSharedPtr.hpp"

namespace Wiz
{
    //////////////////////////////////////////////////////////////////////////

    template<class T>
    class Enable_SharedFromThis
    {
    private:
        typedef T tElement;
    protected:
        Enable_SharedFromThis()
        {
        }
        Enable_SharedFromThis(Enable_SharedFromThis<T> const &)
        {
        }
        Enable_SharedFromThis& operator=(Enable_SharedFromThis<T> const &)
        {
            return *this;
        }
        ~Enable_SharedFromThis()
        {
        }
    public:
        ::Wiz::SharedPtr::Type<T> SharedFromThis()
        {
            ::Wiz::SharedPtr::Type<T> p(m_WeakPtr);
            WIZ_ASSERT(p.Get() == this);
            return p;
        }
        ::Wiz::SharedPtr::Type<T const> SharedFromThis() const
        {
            ::Wiz::SharedPtr::Type<T const> p(m_WeakPtr);
            WIZ_ASSERT(p.Get() == this);
            return p;
        }
        mutable ::Wiz::WeakPtr::Type<tElement> m_WeakPtr;
    };

} /// end of namespace Wiz

#endif /*__WIZ_DATATYPE_ENBALE_SHARED_FROM_THIS_HPP__SHANHAOBO_19800429__*/
